<?xml version="1.0" encoding="ascii"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
          "DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>octant.plotting</title>
  <link rel="stylesheet" href="epydoc.css" type="text/css" />
  <script type="text/javascript" src="epydoc.js"></script>
</head>

<body bgcolor="white" text="black" link="blue" vlink="#204080"
      alink="#204080">
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
       bgcolor="#a0c0ff" cellspacing="0">
  <tr valign="middle">
  <!-- Home link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="octant-module.html">Home</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Tree link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Index link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Help link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>

      <th class="navbar" width="100%"></th>
  </tr>
</table>
<table width="100%" cellpadding="0" cellspacing="0">
  <tr valign="top">
    <td width="100%">
      <span class="breadcrumbs">
        <a href="octant-module.html">Package&nbsp;octant</a> ::
        Module&nbsp;plotting
      </span>
    </td>
    <td>
      <table cellpadding="0" cellspacing="0">
        <!-- hide/show private -->
      </table>
    </td>
  </tr>
</table>
<!-- ==================== MODULE DESCRIPTION ==================== -->
<h1 class="epydoc">Module plotting</h1><p class="nomargin-top"><span class="codelink"><a href="octant.plotting-pysrc.html">source&nbsp;code</a></span></p>
<pre class="literalblock">

octant.plotting - some plotting functions

The plotting module provides some specialized plotting
functions ofen needed in ocean modelling.

Requirements:
=============
pylab, datetime, numpy, scipy

Functions:
==========

sticks - velocity vector stick plot along a time axis
cmap_discretize - create a discrete colorbar from standard colormaps
                  which can be applied to e.g. pcolor
ztodepth - change negative z-ax ticklabels to positive depths
layers - a function for plotting vertical transects based on layer heights

</pre>

<!-- ==================== FUNCTIONS ==================== -->
<a name="section-Functions"></a>
<table class="summary" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
  <td align="left" colspan="2" class="table-header">
    <span class="table-header">Functions</span></td>
</tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a name="cmap_brightened"></a><span class="summary-sig-name">cmap_brightened</span>(<span class="summary-sig-arg">cmap</span>,
        <span class="summary-sig-arg">factor</span>=<span class="summary-sig-default">0.5</span>)</span><br />
      Brightens colormap cmap with using a saturation factor 'factor'
(0.5 by default).</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="octant.plotting-pysrc.html#cmap_brightened">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="octant.plotting-module.html#cmap_discretize" class="summary-sig-name">cmap_discretize</a>(<span class="summary-sig-arg">cmap</span>,
        <span class="summary-sig-arg">N</span>)</span><br />
      Return a discrete colormap from the continuous colormap cmap.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="octant.plotting-pysrc.html#cmap_discretize">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="octant.plotting-module.html#cmap_map" class="summary-sig-name">cmap_map</a>(<span class="summary-sig-arg">function</span>,
        <span class="summary-sig-arg">cmap</span>)</span><br />
      Applies function (which should operate on vectors of shape 3:
[r, g, b], on colormap cmap.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="octant.plotting-pysrc.html#cmap_map">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="octant.plotting-module.html#drawscale" class="summary-sig-name">drawscale</a>(<span class="summary-sig-arg">m</span>,
        <span class="summary-sig-arg">lon</span>,
        <span class="summary-sig-arg">lat</span>,
        <span class="summary-sig-arg">length</span>,
        <span class="summary-sig-arg">yoffset</span>=<span class="summary-sig-default">None</span>,
        <span class="summary-sig-arg">fontsize</span>=<span class="summary-sig-default">8.0</span>,
        <span class="summary-sig-arg">linewidth</span>=<span class="summary-sig-default">0.5</span>)</span><br />
      draw a fancy map scale from lon-length/2,lat-yoffset to
lon-length/2,lat-yoffset, label it with actual distance in km</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="octant.plotting-pysrc.html#drawscale">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="octant.plotting-module.html#layers" class="summary-sig-name">layers</a>(<span class="summary-sig-arg">field</span>,
        <span class="summary-sig-arg">bath</span>,
        <span class="summary-sig-arg">h</span>=<span class="summary-sig-default">None</span>,
        <span class="summary-sig-arg">xc</span>=<span class="summary-sig-default">None</span>,
        <span class="summary-sig-arg">lines</span>=<span class="summary-sig-default">None</span>,
        <span class="summary-sig-arg">missingbath</span>=<span class="summary-sig-default">-10.0</span>,
        <span class="summary-sig-arg">fillvalue</span>=<span class="summary-sig-default">-9999.0</span>,
        <span class="summary-sig-arg">lw</span>=<span class="summary-sig-default">0.5</span>,
        <span class="summary-sig-arg">plotsurface</span>=<span class="summary-sig-default">False</span>,
        <span class="summary-sig-arg">**kwargs</span>)</span><br />
      (perfect for GETM results)</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="octant.plotting-pysrc.html#layers">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="octant.plotting-module.html#sticks" class="summary-sig-name">sticks</a>(<span class="summary-sig-arg">date</span>,
        <span class="summary-sig-arg">u</span>,
        <span class="summary-sig-arg">v</span>,
        <span class="summary-sig-arg">tnorm</span>=<span class="summary-sig-default">0.1</span>,
        <span class="summary-sig-arg">figurewidth</span>=<span class="summary-sig-default">8</span>,
        <span class="summary-sig-arg">pickind</span>=<span class="summary-sig-default">1</span>,
        <span class="summary-sig-arg">color</span>=<span class="summary-sig-default"><code class="variable-quote">'</code><code class="variable-string">blue</code><code class="variable-quote">'</code></span>)</span><br />
      sticks - create velocity stick plot</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="octant.plotting-pysrc.html#sticks">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="octant.plotting-module.html#ztodepth" class="summary-sig-name">ztodepth</a>(<span class="summary-sig-arg">ax</span>=<span class="summary-sig-default">None</span>,
        <span class="summary-sig-arg">ylabelstr</span>=<span class="summary-sig-default"><code class="variable-quote">'</code><code class="variable-string">depth [m]</code><code class="variable-quote">'</code></span>)</span><br />
      on the y-axis to positive depths</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="octant.plotting-pysrc.html#ztodepth">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
</table>
<!-- ==================== FUNCTION DETAILS ==================== -->
<a name="section-FunctionDetails"></a>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
  <td align="left" colspan="2" class="table-header">
    <span class="table-header">Function Details</span></td>
</tr>
</table>
<a name="cmap_discretize"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">cmap_discretize</span>(<span class="sig-arg">cmap</span>,
        <span class="sig-arg">N</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="octant.plotting-pysrc.html#cmap_discretize">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <p>Return a discrete colormap from the continuous colormap cmap.</p>
<blockquote>
cmap: colormap instance, eg. cm.jet.
N: Number of colors.</blockquote>
<dl class="rst-docutils">
<dt>Example</dt>
<dd>x = resize(arange(100), (5,100))
djet = cmap_discretize(cm.jet, 5)
imshow(x, cmap=djet)</dd>
</dl>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<a name="cmap_map"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">cmap_map</span>(<span class="sig-arg">function</span>,
        <span class="sig-arg">cmap</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="octant.plotting-pysrc.html#cmap_map">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  Applies function (which should operate on vectors of shape 3:
[r, g, b], on colormap cmap. This routine will break any discontinuous
points in a colormap.
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<a name="drawscale"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">drawscale</span>(<span class="sig-arg">m</span>,
        <span class="sig-arg">lon</span>,
        <span class="sig-arg">lat</span>,
        <span class="sig-arg">length</span>,
        <span class="sig-arg">yoffset</span>=<span class="sig-default">None</span>,
        <span class="sig-arg">fontsize</span>=<span class="sig-default">8.0</span>,
        <span class="sig-arg">linewidth</span>=<span class="sig-default">0.5</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="octant.plotting-pysrc.html#drawscale">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <p>draw a fancy map scale from lon-length/2,lat-yoffset to
lon-length/2,lat-yoffset, label it with actual distance in km</p>
<dl class="rst-docutils">
<dt>usage drawscale(m - mapping object,</dt>
<dd>lon - lon value of center of scale
lat - lat value of center of scale
length - maximum length shown by scale in km
yoffset - height of scale in &quot;km&quot;
fontsize - fontsize of ticklabels
linewidth - width of used lines)</dd>
</dl>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<a name="layers"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">layers</span>(<span class="sig-arg">field</span>,
        <span class="sig-arg">bath</span>,
        <span class="sig-arg">h</span>=<span class="sig-default">None</span>,
        <span class="sig-arg">xc</span>=<span class="sig-default">None</span>,
        <span class="sig-arg">lines</span>=<span class="sig-default">None</span>,
        <span class="sig-arg">missingbath</span>=<span class="sig-default">-10.0</span>,
        <span class="sig-arg">fillvalue</span>=<span class="sig-default">-9999.0</span>,
        <span class="sig-arg">lw</span>=<span class="sig-default">0.5</span>,
        <span class="sig-arg">plotsurface</span>=<span class="sig-default">False</span>,
        <span class="sig-arg">**kwargs</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="octant.plotting-pysrc.html#layers">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <dl class="rst-docutils">
<dt>plot 2d field as layers with pcolor based on layer heights.</dt>
<dd>(perfect for GETM results)</dd>
<dt>usage: layers(2dfield[kmax,xmax],</dt>
<dd>bath[xmax],
h=h[kmax,xmax],
xc=xc[xmax],
missingbath=-10.0,
fillvalue=-9999.0,
lines=LineColor,
lw=0.5,
<a href="#id1" name="id2"><span class="rst-problematic" id="rst-id2">**</span></a>kwargs)</dd>
</dl>
<p>h,xc,missingbath,fillvalue,shading and lw are optional, default is sigma
coordinates h=bath/kmax, default FillValue=-9999.0,
default lw=0.05, and default xc is the vector of array indices.</p>
<p>Polygons where bath == missingbath in any point are filled
with fillvalue and are masked afterwards.
The 2dfield can be preconfigured with (fillvalue)s where
&quot;layers&quot; should not plot any value (e.g. if certain layers
should be removed)</p>
<p>Additional keyword arguments are passed to pcolor such as
cmap=cm.hsv or shading='flat'.</p>
<p>If lines is given, the layer interfaces are
plotted as lines in color e.g. lines='black'</p>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<a name="sticks"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">sticks</span>(<span class="sig-arg">date</span>,
        <span class="sig-arg">u</span>,
        <span class="sig-arg">v</span>,
        <span class="sig-arg">tnorm</span>=<span class="sig-default">0.1</span>,
        <span class="sig-arg">figurewidth</span>=<span class="sig-default">8</span>,
        <span class="sig-arg">pickind</span>=<span class="sig-default">1</span>,
        <span class="sig-arg">color</span>=<span class="sig-default"><code class="variable-quote">'</code><code class="variable-string">blue</code><code class="variable-quote">'</code></span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="octant.plotting-pysrc.html#sticks">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <p>sticks - create velocity stick plot</p>
<p>sticks(date, u, v, tnorm=0.1, color='blue'             figurewidth=8, pickind=1)</p>
<p>date - list/array of datetime elements
u - list/array of velocity in eastern direction
v - list/array of velocity in northern direction
tnorm - length of a u=max(u,v) as part of the time axis
color - color of sticks
figurewidth - width of the figure in inch
pickind - plot every &quot;pickind&quot;-vector</p>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<a name="ztodepth"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">ztodepth</span>(<span class="sig-arg">ax</span>=<span class="sig-default">None</span>,
        <span class="sig-arg">ylabelstr</span>=<span class="sig-default"><code class="variable-quote">'</code><code class="variable-string">depth [m]</code><code class="variable-quote">'</code></span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="octant.plotting-pysrc.html#ztodepth">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <dl class="rst-docutils">
<dt>ztodepth - change negative z-ax ticklabels</dt>
<dd>on the y-axis to positive depths</dd>
<dt>usage: ztodepth(ax=gca(),</dt>
<dd>ylabelstr='depth [m]')</dd>
</dl>
<p>ztodepth gets the yticks and creates positive yticklabels
for annotation in depth instead of position on z-axis.
Its recommended to change yticks if needed before
running ztodepth.</p>
<p>If ylabelstr is not set to &quot;None&quot;, then the y-axis gets
the label &quot;depth [m]&quot; or other specified with ylabelstr.</p>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<br />
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
       bgcolor="#a0c0ff" cellspacing="0">
  <tr valign="middle">
  <!-- Home link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="octant-module.html">Home</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Tree link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Index link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Help link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>

      <th class="navbar" width="100%"></th>
  </tr>
</table>
<table border="0" cellpadding="0" cellspacing="0" width="100%%">
  <tr>
    <td align="left" class="footer">
    Generated by Epydoc 3.0.1
    on Mon Apr 20 11:56:30 2009
    </td>
    <td align="right" class="footer">
      <a target="mainFrame" href="http://epydoc.sourceforge.net"
        >http://epydoc.sourceforge.net</a>
    </td>
  </tr>
</table>

<script type="text/javascript">
  <!--
  // Private objects are initially displayed (because if
  // javascript is turned off then we want them to be
  // visible); but by default, we want to hide them.  So hide
  // them unless we have a cookie that says to show them.
  checkCookie();
  // -->
</script>
</body>
</html>
